<?php
/*
 * 获取酒店列表
 */
class HotelsController extends CController{
	public function actionList(){
		$key = '0d291452bc581a021494f7b4bdbb3d5d';
		$apptk = isset($_GET['apptk']) ? $_GET['apptk']:'';
		if ($apptk !='' && $key == $apptk){
			$model = new CompanyHotel();
			$model = $model->findAll();
			if(!empty($model)){
				$array = array();
				$array['isok'] = true;
				foreach ($model as $value){
					$arr = array();
					$arr['name'] = CHtml::value($value, 'name');
					$arr['description'] = CHtml::value($value, 'desc');
					$arr['cover'] = CHtml::value($value, 'image');
					$arr['type'] = CHtml::value($value, 'type');//
					$arr['level'] = CHtml::value($value, 'star');
					$arr['ticket'] = CHtml::value($value, 'ticket');//
					$arr['phone'] = CHtml::value($value, 'phone');//
					$arr['traffic'] = CHtml::value($value, 'traffic');
					$arr['latitude'] = CHtml::value($value, 'latitude');//
					$array['data'][] = $arr;
				}
				echo json_encode($array);
			}else {
				$err = array(
					'isok'=>false,
					'msg' =>'数据表数据为空！',
				);
				echo json_encode($err);
			}
		}else {
			$error = array(
					'isok'=>false,
					'msg' =>'秘钥有误！',
			);
			echo json_encode($error);
		}
	}
}
?>